package com.blog.boot.webapp.utils;

public class ShiroUtils extends org.apache.shiro.SecurityUtils {
    /**
     * 获取用户
     */
    public static <T> T getUser(Class<T> entity){
        return getSessionByKey("user",entity);
    }

    /**
     * 根据key返回对象
     */
    public static <T> T getSessionByKey(String key,Class<T> entity){
        return  (T)getSubject().getSession().getAttribute(key);
    }
}
